/**
 * swagger 配置
 */
const expressJSDocSwagger = require('express-jsdoc-swagger');
// 文档地址：https://www.npmjs.com/package/express-jsdoc-swagger

const options = {
  info: {
    title: '染墨接口文档',
    description: '基于 node+express 爬虫 API 接口项目',
    version: '1.0.0',
    license: {
      name: 'MIT'
    }
  },
  security: {
    BasicAuth: {
      type: 'http',
      scheme: 'basic'
    }
  },
  filesPattern: ['../controller/**/*.js'], // 匹配 jsdoc API文件，多文件为数组形式
  swaggerUIPath: '/api-docs',
  baseDir: __dirname // 基础目录
};

module.exports = function (app) {
  expressJSDocSwagger(app)(options);
};
